#pragma once

#include "StartClassifierBehaviorAction.h"

#include "InputPin.h"

namespace uml {

StartClassifierBehaviorAction::StartClassifierBehaviorAction(const QString& umlType)
    : Action(umlType) {}

void StartClassifierBehaviorAction::fromJson(const QJsonObject& json, QStringList& errorList) {
    if (json.isEmpty()) {
        return;
    }

    Action::fromJson(json, errorList);
    object_ = JsonSerializable::create<InputPin>(json.value("object"), errorList);

}

void StartClassifierBehaviorAction::toJson(QJsonObject& json) {
    Action::toJson(json);
    if (object_) {
        QJsonObject object_json;
        object_->toJson(object_json);
        json.insert("object", object_json);
    }
}

/// <summary>
/// object getter
/// The InputPin that holds the object whose classifierBehavior is to be started.
/// </summary>
shared_ptr<InputPin> StartClassifierBehaviorAction::object() const {
    return object_;
}

/// <summary>
/// object setter
/// The InputPin that holds the object whose classifierBehavior is to be started.
/// </summary>
void StartClassifierBehaviorAction::setObject(shared_ptr<InputPin> value) {
    object_ = value;
}

} // namespace uml
